﻿/* Write a program to convert binary numbers to their decimal representation. */

using System;

class BinaryToDecimal
{
    static void Main()
    {
        //Proverka za bukva ili specialen znak
        // proverka za poveche ot 32 simvola
        
        Console.WriteLine("Please enter binary number");
        string binaryNumber = Console.ReadLine();
        int sum = 0;
        for (int i = binaryNumber.Length-1; i >= 0; i--)
        {
            int num = int.Parse(binaryNumber[i].ToString());
            sum += num*(int)(Math.Pow(2,((binaryNumber.Length-1) - i)));
        }

        Console.WriteLine("The decimal number is: {0}", sum);     
    }
}
